<template>
	<view class="content">
		<web-view v-if="url" :src="url"></web-view>
		<view class="contentbox" v-else-if="content">
			<u-parse :html="content"></u-parse>
		</view>
		<video v-else-if="videourl" :src="videourl" autoplay></video>
	</view>
</template>

<script>
	export default {
		data () {
			return {
				content: '',
				url: '',
				videourl: ''
			}
		},
		onLoad(options) {
			var _this = this
			if(options){
				if(options.url){
					this.url = options.url
				} else if(options.id) {
					this.$getPageContent(options.id, function(data){
						uni.setNavigationBarTitle({
							title:data.title
						})
						_this.content = data.body
					})
				} else if(options.video){
					this.videourl = options.video
				}
			}
		}
	}
</script>

<style scoped lang="scss">
	.content{
		/* #ifndef H5 */
		min-height: 100vh;
		/* #endif */
		/* #ifdef H5 */
		min-height: calc(100vh - 44px);
		/* #endif */
		background-color: #fff;
		.contentbox{
			padding: 20rpx 30rpx;
		}
		video{
			width: 100vw;
			height: 100vh;
		}
	}
</style>
